package org.example.mapper;

import org.apache.ibatis.annotations.*;

import org.example.pojo.Emp;

import java.time.LocalDate;
import java.util.List;

/**
 * 包名：org.example.mapper
 * 用户：admin
 * 日期：2025-09-12
 * 项目名称：pro-demo
 */
@Mapper
public interface EmpMapper {

    List<Emp> page(@Param("name") String name,
                   @Param("gender") Short gender,
                   @Param("begin") LocalDate begin,
                   @Param("end") LocalDate end);
//    List<Emp> page(String name,Short gender, LocalDate begin,LocalDate end);

    void delete(List<Integer> ids);

    @Insert("insert into emp(username,name,gender,image,job,entrydate,dept_id,create_time,update_time)" +
            "values(#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp getById(Integer id);

    void update(Emp emp);

    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp vertify(Emp emp);

    @Delete("delete from emp where dept_id = #{id}")
    void deleteByDeptId(Integer id);
}
